<template>
  <div>
    <h1>ref和$refs获取原生dom元素</h1>
    <p ref="title">这是一个p标签</p>
    <button @click="getP">点我获取p标签</button>
    <h1>ref和$refs获取组件对象</h1>
    <Demo ref="de" />
    <button @click="getDemo">点我获取组件对象</button>
  </div>
</template>

<script>
import Demo from './components/Demo.vue'
export default {
  components: {
    Demo
  },
  

  data() {
    return {
      
    };
  },


  methods: {
    getP(){
      console.log(this.$refs.title);
    },
    getDemo(){
      console.log(this.$refs.de);
      console.log(this.$refs.de.msg);
    }

    
    
  },
};
</script>

<style  scoped>

</style>